package com.miyake.loveviewweb.client.plugin;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.Grid;
import com.miyake.loveviewweb.client.dialog.DialogHandler;
import com.miyake.loveviewweb.client.dialog.IDialogPanel;
import com.miyake.loveviewweb.shared.model.PluginModel;

public class PluginDetail extends Composite implements HasText, IDialogPanel {

    private static PluginDetailUiBinder uiBinder = GWT
        .create(PluginDetailUiBinder.class);
    @UiField Grid grid;

    interface PluginDetailUiBinder extends UiBinder<Widget, PluginDetail> {
    }

    public PluginDetail(PluginModel plugin) {
        initWidget(uiBinder.createAndBindUi(this));
        
        grid.resize(9, 2);

        grid.setText(0, 0, "Service Name");grid.setText(0, 1, plugin.getServiceName());
        grid.setText(1, 0, "Category");grid.setText(1, 1, plugin.getCategory());
        grid.setText(2, 0, "Description");grid.setText(2, 1, plugin.getDescription());
        grid.setText(3, 0, "Company URL");grid.setText(3, 1, plugin.getCompanyUrl());
        grid.setText(4, 0, "Service URL");grid.setText(4, 1, plugin.getServiceUrl());
        grid.setText(5, 0, "Version");grid.setText(5, 1, plugin.getServiceVersion());
        grid.setText(6, 0, "License");grid.setText(6, 1, plugin.getLicense());
        grid.setText(7, 0, "Provider");grid.setText(7, 1, plugin.getProvider());
    }

    public PluginDetail(String firstName) {
        initWidget(uiBinder.createAndBindUi(this));
    }

    public void setText(String text) {

    }

    public String getText() {
        return "";
    }

    public void setDialogHandler(DialogHandler handler) {
        // TODO Auto-generated method stub
        
    }

    public Composite getComposite() {
        return this;
    }

}
